import request from '@/utils/request'
//获取角色信息
export const reqRoleInfo = (page,limit,roleName='')=>request.get(`/admin/acl/role/${page}/${limit}?roleName=${roleName}`)

// 添加角色
export const reqSaveRole = (data) => { 
    if (data.id) {
        return request.put(`/admin/acl/role/update`,data)
    } else { 
        return request.post(`/admin/acl/role/save`,data)
    }
}

//根据id获取权限
export const reqRoleAuth = (id)=>request.get(`/admin/acl/permission/toAssign/${id}`)

//给角色设置权限
export const reqAssign = (roleId,permissionId)=>request.post(`/admin/acl/permission/doAssign?roleId=${roleId}&permissionId=${permissionId}`)

// 删除角色
export const reqRemove  =id=>request.delete(`/admin/acl/role/remove/${id}`)

export const reqRemoveSelect = idList=>request.delete(`/admin/acl/role/batchRemove`,{data:{idList}})

// export const reqRemoveSelect = (ids) => {
//     console.log(ids);
//     return request({
//       url: `/admin/acl/role/batchRemove`,
//       method: 'delete',
//       data: {ids}
//     })
//   }